package com.example.everying.model.entity.chat;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.example.everying.model.dto.chat.LocationDto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @program: everything
 * @description: 聊天消息实体类
 * @author: szy
 * @create: 2025-05-19 10:00
 **/
@Data
@TableName("chat_messages")
public class ChatMessagesEntity implements Serializable {

    @ApiModelProperty(value = "消息ID")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @NotNull(message = "id不能为空")
    private String id;

    @ApiModelProperty(value = "业务id")
    private String bizId;

    @ApiModelProperty(value = " 消息类型 0-文本 1-图片 2-视频 3-位置信息 4-转账消息 5-卡片消息")
    private String type;

    @ApiModelProperty(value = "会话ID")
    @NotNull(message = "会话ID不能为空")
    private String conversationId;

    @ApiModelProperty(value = "消息内容")
    private String postMessages;

    @ApiModelProperty(value = "消息接收状态: 1-已读, 2-未读, 3-已撤回")
    private String msgStatus;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "发送时间")
    private LocalDateTime time;

    @ApiModelProperty(value = "消息类型(0-评论 1-文章申请 2-聊天消息 3-位置信息 4-转账消息 5-卡片消息)")
    private String messagesType;

    @ApiModelProperty(value = "发送消息用户ID")
    private String formUserId;

    @ApiModelProperty(value = "接收消息用户ID")
    private String toUserId;

    @ApiModelProperty(value = "位置信息")
//    @TableField(value = "location_info", typeHandler = FastjsonTypeHandler.class)
    private String locationInfo;

    @ApiModelProperty(value = "卡片信息")
    private String cardInfo;

    @ApiModelProperty(value = "是否删除0-未删除 1-删除")
    private Integer isDelete;
}
